package com.dongdong.controller;


import com.dongdong.model.TbItem;
import com.dongdong.service.ItemService;
import com.dongdong.vo.ItemVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/item")
public class ItemController {

    @Autowired
    private ItemService itemService;

    @GetMapping("/getItemById")
    public TbItem getItemById(@RequestParam Long id){
        return itemService.getItemById(id);
    }


    /**
     * 扣减库存
     * @param itemVOS
     */
    @PostMapping("/subCount")
    public void subCount(@RequestBody List<ItemVO> itemVOS){
        itemService.subCount(itemVOS);
    }
}
